1. Field
The present disclosure relates to compilation and optimization of software code and more specifically, to a method of partial inlining code.
2. Description of the Related Art
In the JAVA programming language environment, JAVA source code is compiled by a JAVA compiler into an intermediate and architecture neutral format referred to as bytecode. Bytecode is neither human readable nor able to be executed by a data processing system. JAVA applications typically are compiled using a JAVA compiler and may be distributed in the intermediate bytecode format. In order to execute a JAVA application on a user's computer or data processing system, the JAVA bytecode is interpreted by a Java Virtual Machine (JVM). The JVM resides in the data processing system and creates machine code instructions for the specific architecture of the data processing system. Thus, rather than compiling JAVA source code into numerous architecture specific object code or machine code formats, the neutral intermediate bytecode is available and can be interpreted and executed using the JVM. While this provides portability for JAVA software applications, code is interpreted and executed dynamically such as on a line by line basis and typically executes more slowly than applications in other programming languages which execute from object code compiled directly from source code.
A JVM may include a just-in-time (JIT) compiler which re-compiles some or all of the JAVA bytecode at execution time into platform specific machine code in order to improve performance and execution speed. The JIT compiler may analyze and compile blocks of code in order to create an optimized version of machine code for the architecture of the data processing system. To further improve performance, the JIT compiler may perform an optimization technique known as inlining. Inlining is the process of replacing a method call in the code being compiled with the code of the entire method itself. As a result of inlining, the overhead of performing the method call is eliminated and more code is exposed to optimization by the JIT compiler. However, methods often include rarely executed or cold code such as debugging code that increases the size of the method and inlined code. A fully inlined method may increase compile time and cold code in the method can interfere with optimizing the hot path by introducing unnecessary merges and branches in the control flow graph (CFG).
Partial inlining is a compiler optimization method in which only part of a called method is inlined instead of inlining the method code in its entirety. Since non-inlined code is removed, in order to perform partial inlining, provision must be made to handle the case where program control falls into code that was not inlined.